<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2018/12/10
 * Time: 14:14
 */

namespace app\admin\controller;


use think\facade\Log;
use think\facade\Request;
use think\File;

class Upload extends BaseController
{
    /**
     * 因为是ajax请求的上传图片，所以请求过来的是一个数组
     * 取数组的第一个元素就是文件的对象
     * @return \think\response\Json
     */
    public function upload_img()
    {
        $file = Request::file()['file'];
        $upload = new \Upload\Upload($file);
        $result = $upload->ajax_upload();
        return json($result);
    }
}